//MyCollection.java
package com.xyc.ch8;
import java.util.*;

public class MyCollection{
   public static void main(String[] args)  {
	   List myList=new ArrayList();
	   myList.add("A string");
	   myList.add(new Integer(1));
	// String s1=myList.get(0);      编译错误
	   String s2=(String)myList.get(0);
	// String i1=(String)myList.get(1); 运行异常
	   Integer i2=(Integer)myList.get(1);

	   System.out.println (s2);
	   System.out.println (i2);
   }
}
